<% layout('/layouts/default.html', {title: '待办批示', libs: ['dataGrid']}){ %>
<div class="main-content">
	<div class="box box-main">
		<div class="box-header">
			<#form:form id="searchForm" model="${dcSupTaskActionDto}" action="${ctx}/action/dcSupTaskAction/findListData" method="post" class="form-inline"
			data-page-no="${parameter.pageNo}" data-page-size="${parameter.pageSize}" data-order-by="${parameter.orderBy}">
			<div style="float: right">
				<div class="form-group">
					<label class="control-label">${text('任务年度')}：</label>
					<div class="control-inline width-160">
						<#form:select path="taskYear" items="${yearList}" blankOption="true" data-placeholder="请选择" itemLabel="yearLabel" itemValue="yearValue" class="form-control width-120" />
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">${text('任务标题')}：</label>
					<div class="control-inline width-160">
						<#form:input path="taskTitle" maxlength="200" class="form-control width-160" placeholder="请输入任务标题"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">${text('任务类型')}：</label>
					<div class="control-inline width-160">
						<#form:select path="taskTypeCode" items="${dicts}" blankOption="true" data-placeholder="请选择任务类型" itemLabel="dictLabel" itemValue="dictValue" class="form-control width-160 " />
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">${text('是否已批示')}：</label>
					<div class="control-inline width-160">
						<% var items = [{label:'是',value:'2'},{label:'否',value:'1'}]; %>
						<#form:select path="explainFlag" items="${items}" blankOption="true" data-placeholder="是否批示" itemLabel="label" itemValue="value" class="form-control width-160 " />
					</div>
				</div>

				<div class="form-group">
					<button type="submit" class="btn btn-primary btn-sm">${text('查询')}</button>
					<button onclick="cz();" class="btn btn-default btn-sm">${text('重置')}</button>
				</div>
			</div>
		</#form:form>
		</div>
		<div class="box-body">
			<table id="dataGrid"></table>
			<div id="dataGridPage"></div>
		</div>
	</div>
</div>
<% } %>
<script>
	//重置
	function cz(){
		searchForm.reset();
		$('#dataGrid').dataGrid('reloadGrid');
	}

	// 初始化DataGrid对象
$('#dataGrid').dataGrid({
	searchForm: $("#searchForm"),
	sortableColumn: false, // 列表不允许排序
	columnModel: [
		// {header:'${text("任务年度")}', name:'taskYear', index:'a.task_year', width:80, align:"center"},
		{header:'${text("督办字号")}', name:'messageNumber', index:'a.message_number', width:100, align:"left"},
		{header:'${text("任务标题")}', name:'taskTitle', index:'a.task_title', width:150, align:"left"},
		{header:'${text("任务类型")}', name:'taskTypeName', index:'a.task_type_code', width:150, align:"left"},
		{header:'${text("任务内容")}', name:'taskContent', index:'a.task_content', width:150, align:"left",formatter: function(val, obj, row, act){
				return '<a href="${ctx}/taskdeploy/dcSupTaskInfo/detailForm?id='+row.taskId+'&actionId='+row.id+'" class="btnList" data-title="${text("督办任务信息")}">'+(val||'暂无内容')+'</a>';
			}},
		{header:'${text("牵头责任单位")}', name:'leaderOrgName', index:'a.leader_org_name', width:150, align:"left"},
		{header:'${text("牵头领导")}', name:'taskLeaderName', index:'a.task_leader_name', width:150, align:"left"},
		// {header:'${text("督办科室")}', name:'taskSupOrgName', index:'a.task_sup_orgname', width:120, align:"left"},
		{header:'${text("联系人")}', name:'contactName', index:'a.contact_name', width:120, align:"center"},
		{header:'${text("批示状态")}', name:'explainFlag', index:'a.contact_name', width:120, align:"center",hidden:true},
		{header:'${text("任务状态")}', name:'taskStatus', index:'a.task_status', width:150, align:"center", frozen:true, formatter: function(val, obj, row, act){
				return  js.getDictLabel(${@DictUtils.getDictListJson('dc_task_action_status')}, val, '${text("未知")}', true);
			}
		},
		{header:'${text("操作")}', name:'actions', width:120, align:"center",formatter: function(val, obj, row, act){
			var actions = [];
			<% if(hasPermi('action:dcSupTaskAction:edit')){ %>
				if(row.explainFlag=='1'){
					 actions.push('<a href="${ctx}/action/dcSupTaskAction/forms?id='+row.id+'&taskId='+row.taskId+'" class="btn btn-primary btn-xs btnList" title="${text("批示")}">批示</a>&nbsp;&emsp;');
				} else if (row.explainFlag=='2'){
					actions.push('<a href="${ctx}/action/dcSupTaskAction/forms?id='+row.id+'&taskId='+row.taskId+'" class="btn btn-primary btn-xs btnList" title="${text("查看")}">查看</a>&nbsp;&emsp;');
				}
			<% } %>
			return actions.join('');
		}}
	],
	// 加载成功后执行事件
	ajaxSuccess: function(data){

	}
});

	function clickTwo(id){
		js.layer.open({
			type: 2,
			title: ['领导批示'],
			area: ['800px', '400px'],
			scrollbar: true,
			shadeClose: false,
			content: "${ctx}/action/dcSupTaskAction/forms?id="+id,
			btn1: function (index, layero) {
			},
			end:function () {
				$('#dataGrid').dataGrid('refresh', $('#dataGrid').dataGrid('getParam', 'page'), 20);
			}
		});
	}
</script>